<?php

namespace app\api\model\vipcard;

use app\common\model\vipcard\OrderPlan as OrderPlanModel;
use think\Db;
/**
 * 用户充值订单套餐快照模型
 * Class OrderPlan
 * @package app\api\model\recharge
 */
class OrderPlan extends OrderPlanModel
{
    /**
     * 新增记录
     * @param $orderId
     * @param $data
     * @return false|int
     */
    public function add($orderId, $data)
    {
        $data = [
            'order_id' => $orderId,//订单id
            'card_id' => $data['card_id'],//会员卡id
            'card_title' => $data['card_title'],//会员卡名称
            'card_money' => $data['card_money'],//会员卡面值
            'card_real_money' => $data['card_real_money'],//会员卡面实付金额
            'bonus_percent' => $data['bonus_percent'],//分红比例
            'reward_percent' => $data['reward_percent'],//赏金比例
            'reward_point' => $data['reward_point'],//赠送积分
            'wxapp_id' => $data['wxapp_id'],//小程序商城id
            'image_id' =>  $data['image_id'],//image_id
            'create_time' => time(),//创建时间
            'update_time' => time(),//更新时间
        ];

        return Db::name('wxapp_card_order_plan')->insertGetId($data);

    }

}